from pymongo import MongoClient
import random
import datetime

client = MongoClient('172.29.174.125', 27017)

db = client.test

table = db.unicorns

epoch = random.randint(0, 100)
data = {
    'lr': 1e-3,
    'batch_size': 256,
    'epoch': epoch,
    'parent_epoch': 0
}
ret = table.insert_one(data)
print('Newly insert:', ret.inserted_id)

data_list = [
    {
        "author": "Mike",
        "text": "Another post!",
        "tags": ["bulk", "insert"],
        "date": datetime.datetime(2009, 11, 12, 11, 14)
    },
    {
        "author": "Eliot",
        "title": "MongoDB is fun",
        "text": "and pretty easy too!",
        "date": datetime.datetime(2009, 11, 10, 10, 45)
    }
]
ret = table.insert_many(data_list)
print('Newly insert:', ret.inserted_ids)
